package com.xhsj.user.pms.patent.mapper;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.xhsj.user.generalprocess.vo.GeneralAuditVo;
import com.xhsj.user.pms.overseas.dto.PatentListByCountryNameDto;
import com.xhsj.user.pms.overseas.query.ApplyNumAndPublicNumQuery;
import com.xhsj.user.pms.overseas.query.CaseTreeListQuery;
import com.xhsj.user.pms.patent.domain.TbPamOverseasApply;
import com.xhsj.user.pms.patent.dto.FindRunTaskDto;
import com.xhsj.user.pms.patent.dto.PatentByArchivesNumDto;
import com.xhsj.user.pms.patent.query.PatentListByCountryNameQuery;
import com.xhsj.user.pms.patent.vo.*;
import org.apache.ibatis.annotations.Mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Param;

import java.time.LocalDate;
import java.util.List;
import java.util.Map;

/**
 * <p>
 * 专利模块海外申请表 Mapper 接口
 * </p>
 *
 * @author suxiaolin
 * @since 2021-01-25
 */
@Mapper
public interface TbPamOverseasApplyMapper extends BaseMapper<TbPamOverseasApply> {

    /**
     * 通过dataId 查询历史任务
     * @author 苏小林
     * @date 2021/1/25 17:15
     * @param: dataIds
     * @return: java.util.List<com.xhsj.user.pms.patent.vo.FindHiTaskVo>
     */
    List<FindHiTaskVo> findHiTaskByDataIds(@Param("dataIds") List<Long> dataIds,@Param("baseParam") FindRunTaskDto baseParam);

    /**
     * 通过dataId 查询正在执行任务
     * @author 苏小林
     * @date 2021/1/26 11:13
     * @param: dataIds
     * @return: java.util.List<com.xhsj.user.pms.patent.vo.FindRunTaskVo>
     */
    List<FindRunTaskVo> findRunTaskByDataIds(@Param("dataIds") List<Long> dataIds,@Param("baseParam") FindRunTaskDto baseParam);

    /**
     * 通过dataId查询数据
     * @author 苏小林
     * @date 2021/1/27 14:17
     * @param: dataId
     * @return: com.xhsj.user.pms.patent.domain.TbPamOverseasApply
     */
    TbPamOverseasApply getByDataId(@Param("dataId") Long dataId);

    /**
     * 修改节点id 和 节点名称
     * @author 苏小林
     * @date 2021/1/28 14:09
     * @param: tbPamOverseasApply2
     */
    void updateNodeIdAndNodeName(@Param("entity") TbPamOverseasApply entity);

    // 案件树
    List<CaseTreeListQuery> caseTreeList(@Param("searchName") String searchName);

       /**
           * @Description: 获取申请号和公开号
           * @Param:  num 交底书编号
           * @return: List<Map<String,String>>
           * @Author: liuqinghua
           * @Date: 2021/3/1
           */
     ApplyNumAndPublicNumQuery getApplyNumAndPublicNum(@Param("num") String num);

    /**
     * 查询海外申请列表
     * @author 苏小林
     * @date 2021/3/1 16:39
     * @param: page
     * @return: com.baomidou.mybatisplus.core.metadata.IPage<com.xhsj.user.pms.patent.vo.OverseasApplyListVo>
     */
    IPage<OverseasApplyListVo> findApplyList(Page<TbPamOverseasApply> page,
                                             @Param("regionalDetailsId") Long regionalDetailsId,
                                             @Param("overseasOfficeNum") String overseasOfficeNum,
                                             @Param("name") String name,
                                             @Param("priorityNum") String priorityNum,
                                             @Param("relatedNum") String relatedNum,
                                             @Param("applyTypeId") Integer applyTypeId,
                                             @Param("countryName") String countryName,
                                             @Param("nodeId") Integer nodeId,
                                             @Param("archivesNum") String overseasArchivesNum,
                                             @Param("overseasApplyNum") String overseasApplyNum);

    /**
     * 保存海外国家字典
     * @author 苏小林
     * @date 2021/3/10 15:23
     * @param: name
     */
    void saveCountryDict(@Param("name")  String name);

    /**
     * 查询海外国家字典
     * @author 苏小林
     * @date 2021/3/10 15:27
     * @return: java.util.List<java.util.Map<java.lang.String,java.lang.String>>
     */
    List<Map<String, String>> getCountryDict();

    /**
     * 获取申请类型列表
     * @author 苏小林
     * @date 2021/3/11 14:03
     * @return: java.util.List<java.util.Map<java.lang.String,java.lang.String>>
     */
    List<Map<String, String>> getApplyTypeList();

    void deleteDataById(@Param("id") Long id);

    /**
     * @Description: 根据国家名获取数据-分页
     * @Param: PatentListByCountryNameDto
     * @return:
     * @Author: liuqinghua
     * @Date: 2021/6/1
     */
    IPage<PatentListByCountryNameQuery> getPatentListByCountryName(Page<PatentListByCountryNameQuery> page, @Param("data") PatentListByCountryNameDto data);

    /**
     * @Description: 根据国家名获取数据
     * @Param: PatentListByCountryNameDto
     * @return:
     * @Author: liuqinghua
     * @Date: 2021/6/2
     */
    List<PatentListByCountryNameQuery> getPatentListByCountryName(@Param("data") PatentListByCountryNameDto data);

       /**
           * @Description: 修改关联的案件
           * @Param:
           * @return:
           * @Author: liuqinghua
           * @Date: 2021/6/2
           */
    void updateOverseasPatent(@Param("countryDictName") String countryDictName, @Param("countryDictId") Long countryDictId);

    /**
     * @Description: 获取审批意见
     * @Param:  Long dataId, Long nodeId
     * @return:  String
     * @Author: liuqinghua
     * @Date: 2021/6/16
     */
    List<Map<String,Object>> getOpinionTextByNodeId(@Param("entity") GeneralAuditVo entity);

    /**
     * @Description: 获取节点最新节点
     * @Param:  dataId 业务id
     * @return:
     * @Author: liuqinghua
     * @Date: 2021/6/16
     */
    List<Map<String, Object>> getNewNodeIdByDataId(@Param("entity") GeneralAuditVo entity);

    IPage<OverseasApplyAuditTransferOutListVo> findOverseasApplyPersonalTransferInList(Page<OverseasApplyAuditTransferOutListVo> page,
                                                                                       @Param("userId") Long userId);
   /**
       * @Description: 待审核 
       * @Param:  
       * @return:  
       * @Author: liuqinghua
       * @Date: 2021/6/29 
       */
    IPage<FindRunTaskVo> findRunTask(Page<FindRunTaskVo> page,@Param("entity") GeneralAuditVo entity,@Param("baseParam") FindRunTaskDto baseParam);
       /**
           * @Description: 审核历史 
           * @Param:  
           * @return:  
           * @Author: liuqinghua
           * @Date: 2021/6/29 
           */
    IPage<FindHiTaskVo> findHiTaskList(Page<FindRunTaskVo> page,@Param("entity") GeneralAuditVo entity, @Param("baseParam") FindRunTaskDto baseParam);

       /**
           * @Description: 获取已立案国家
           * @Param:  
           * @return:  
           * @Author: liuqinghua
           * @Date: 2021/7/29 
           */
    List<Map<String,String>> getCountryByDisclosureIds(@Param("disclosureIdList") List<String> disclosureIdList);
   /**
       * @Description:
       * @Param:
       * @return:
       * @Author: liuqinghua
       * @Date: 2021/7/30
       */
    IPage<Map<String, Object>> getOverseasPatentByArchivesNum(Page<Map<String, Object>> page,@Param("param")  PatentByArchivesNumDto param);
    /**
     * @Description: 专利统计-海外已完成
     * @Param:  date 日期
     * @Author: liuqinghua
     * @Date: 2021/9/6
     */
    Integer getOverseasComplete(@Param("date") String date,@Param("isNow") boolean isNow);
}
